package org.example.service;

import org.example.dao.BookDao;
import org.example.pojo.Books;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 张勇
 * @create 2021/1/23 19:53
 */

public class BookServiceImpl implements BookService {
    //service层调用dao层，组合dao层

    private BookDao bookDao;

    public void setBookDao(BookDao bookDao){
        this.bookDao=bookDao;
    }


    @Override
    public int addBook(Books books) {
        return bookDao.addBook(books);
    }

    @Override
    public int deleteBookById(int id) {
        return bookDao.deleteBookById(id);
    }

    @Override
    public int updateBook(Books books) {
        return bookDao.updateBook(books);
    }

    @Override
    public Books queryBookById(int id) {
        return bookDao.queryBookById(id);
    }

    @Override
    public List<Books> queryAllBooks() {
        return bookDao.queryAllBooks();
    }

    @Override
    public Books queryBookByName(String bookName) {
        return bookDao.queryBookByName(bookName);
    }
}
